package org.zsl.controller.servlet;

import com.alibaba.fastjson.JSON;
import org.zsl.model.User;
import org.zsl.service.UserService;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;

public class UserListController extends HttpServlet {
    private UserService userService = new UserService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


//        String tomcatHome = System.getenv("TOMCAT_HOME");
//        System.out.println(tomcatHome);

       List<User> list=   userService.getList();

       String listStr= JSON.toJSONString(list);


       response.getWriter().write(listStr);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
